---
---


<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

	<link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/common/css/stylesheet.css"/>
	<link rel="stylesheet" href="{{ site.baseurl }}/common/css/stylesheet-fonts.css" type="text/css" charset="utf-8">
	<link rel="icon" href="{{ site.baseurl }}/common/css/favicon.ico" type="image/x-icon">
	<link rel="shortcut icon" href="{{ site.baseurl }}/common/css/favicon.ico" type="image/x-icon">
	<title>How to Apply and Revert Magento Patches</title>

</head>

<body>

<img src="{{ site.baseurl }}/guides/m1x/images/m1xheader.png" width="1024" alt="header" />
{% include m1x/eol_message.html %}

<h1>How to Apply and Revert Magento Patches</h1>

<div id="content">

	<!-- Title: How to Apply and Revert Magento Patches -->
	<!-- URL: apply-revert-magento-patches -->

	<h4 id="contents">Table of Contents</h4>
	<ul><li><a href="#overview">Overview</a></li>
		<li><a href="#detail">Need More Detail?</a></li>
		<li><a href="#get">How to Get Magento Patches</a></li>
		<li><a href="#apply">How to Apply a Magento Patch</a></li>
		<li><a href="#apply-8788">How to Apply the SUPEE-8788 Patch</a></li>
		<li><a href="#id">Listing Patches You Have Installed</a></li>
		<li><a href="#revert">How to Revert a Magento Patch</a></li>
		<li><a href="#trouble">Troubleshooting</a></li></ul>

	<h2 id="overview">Overview</h2>
	<p>This article discusses how to apply and revert Magento patches you get in any of the following ways:
	<ul><li>Magento Support</li>
		<li>Magento Enterprise Edition (EE) support portal</li>
		<li>(Magento partners) from the <a href="https://partners.magento.com" target="_blank">partner portal</a></li></ul>
	<p>If you don't already have a patch, <a href="http://support.magentocommerce.com/" target="_blank">contact Magento Support</a>.</p>
	<div class="msg-box important"><img src="{{ site.baseurl }}/guides/m1x/images/icon-note.png" alt="note" align="left" width="40"><span><strong>Note</strong>: This article assumes your patch file name ends in <code>.sh</code>. If your patch file name ends in <code>.patch</code> or something else, <a href="http://support.magentocommerce.com/" target="_blank">contact Magento Support</a> before proceeding.</div>

	<h2 id="detail">Need More Detail?</h2>
	<p>For more step-by-step details that are provided here, see one of the following:</p>
	<ul><li><a href="https://info.magento.com/rs/magentocommerce/images/Installing-a-Patch-for-Magento-Community-Edition.pdf" target="_blank">Magento CE patch instructions</a></li>
		<li><a href="https://info.magento.com/rs/magentocommerce/images/Installing-a-Patch-for-Magento-Enterprise-Edition.pdf" target="_blank">Magento EE patch instructions</a></li></ul>

	<h2 id="get">How to Get Magento Patches</h2>
	<p>Magento Support provides some patches for Magento CE and EE on magentocommerce.com. This section discusses how to get those patches.</p>
	<p>If Magento Support provided a patch to you, skip this section and continue with <a href="#apply">How to Apply a Magento Patch</a>.</p>
	<p>See one of the following sections for specific information about Magento CE or EE:</p>
	<ul><li><a href="#get-ce">Getting Magento CE Patches</a></li>
		<li><a href="#get-ee">Getting Magento EE Patches</a></li></ul>

	<h3 id="get-ce">Getting Magento CE Patches</h3>
	<p>To get patches for Magento CE:</p>
	<ol><li>Log in to <a href="https://www.magentocommerce.com/download" target="_blank">magentocommerce.com/download</a>.<br />
		(Click <strong>My Account</strong> in the upper right corner of the page.)<br />
		If you don't have an account, you can register for one; the account is free.</li>
		<li>In the Magento Community Edition Patches section, locate the patch to install.</li>
		<li>From the list next to the patch, choose your CE version.</li>
		<li>Click <strong>Download</strong>.</li>
		<li>After the patch downloads, continue with <a href="#apply">How to Apply a Magento Patch</a>.</li></ol>

	<h3 id="get-ee">Getting Magento EE Patches</h3>
	<p>To get patches for Magento EE:</p>
	<ol><li>Log in to <a href="https://www.magentocommerce.com" target="_blank">magentocommerce.com</a>.<br />
		(Click <strong>My Account</strong> in the upper right corner of the page.)</li>
		<li>Click <strong>Downloads</strong> in the left pane.</li>
		<li>Click <strong>Magento Enterprise Edition</strong> in the right pane.<br />
			The following figure shows an example.<br />
			<img src="{{ site.baseurl }}/guides/m1x/images/EE-spt-portal.png" height="554px" width="812px"></li>
		<li>Click <strong>Support Patches</strong>.</li>
		<li>Locate the patch to download.</li>
		<li>Click <strong>Download</strong> corresponding to the patch for the version of EE you're using.</li>
		<li>After the download completes, continue with the next section.</li></ol>

	<h2 id="apply">How to Apply a Magento Patch</h2>
	<p>To apply a Magento patch:</p>
	<ol><li>Transfer the patch <code>.sh</code> file to your Magento installation root directory.<br />
		<div class="msg-box important"><img src="{{ site.baseurl }}/guides/m1x/images/icon-note.png" alt="note" align="left" width="40"><span><strong>Note</strong>: This article assumes your patch file name ends in <code>.sh</code>. If your patch file name ends in <code>.patch</code> or something else, <a href="http://support.magentocommerce.com/" target="_blank">contact Magento Support</a> before proceeding.</div>

		For example, <code>/var/www/html/magento</code>.</li>
		<li>Enter the following commands as a user with sufficient privileges to write to Magento files (typically, the web server user or <code>root</code>):
			<pre>chmod +x &lt;patch-file-name>.sh
./&lt;patch-file-name>.sh</pre>
			A message such as the following displays to confirm the patch installed successfully:
			<pre>Patch was applied/reverted successfully.</pre></li>
		<li>To reapply ownership to the files changed by the patch:
			<ol><li>Find the web server user: <code>ps -o "user group command" -C httpd,apache2</code><br />
				The value in the USER column is the web server username.<br />
				Typically, the Apache web server user on CentOS is <code>apache</code> and the Apache web server user on Ubuntu is <code>www-data</code>.</li>
				<li>As a user with <code>root</code> privileges, enter the following command from the Magento installation directory:
					<pre>chown -R <em>web-server-user-name</em> .</pre>
					For example, on Ubuntu where Apache usually runs as <code>www-data</code>, enter
					<pre>chown -R www-data .</pre></li></ol>
		</li>
		<li>Perform any other tasks as instructed by Magento Support.<br />
			(For example, some patches require you to stop external services, such as the Solr search engine.)</li></ol>

	<h2 id="apply-8788">How to Apply the SUPEE-8788 Patch</h2>
	<p>We released a <a href="https://magento.com/security/patches/supee-8788" target="_blank">security patch</a> in October, 2016 that might cause issues for some users. This section applies to you if any of the following is true:</p>
	<ul><li>You haven't yet applied the SUPEE-8788 patch and your Magento version is earlier than EE 1.14.1.0 or CE 1.9.1.0.</li>
		<li>You applied version 1 of the SUPEE-8788 patch. (The patch name includes <code>PATCH_SUPEE-8788_&lt;magento version>_v1</code>.)</li>
		<li>You previously applied the SUPEE-1533 patch and you want to apply the SUPEE-8788 patch.</li>
		<li>You're applying the SUPEE-8788 patch as part of an upgrade from an earlier Magento version.</li></ul>

	<p>We recommend the following:</p>
	<ul><li>If you applied SUPEE-8788 version 1, revert that patch, revert SUPEE-1533 (version restrictions apply), apply SUPEE-3941 (version restrictions apply), then <a href="#apply-8788-v1">apply SUPEE-8788 version 2 or later</a>. </li>
		<li>If you haven't applied SUPEE-8788, revert SUPEE-1533 (version restrictions apply), apply SUPEE-3941 (version restrictions apply), then <a href="#apply-8788-new">apply SUPEE-8788</a>.</li></ul>

	<h3 id="apply-8788-v1">Replace SUPEE-8788 version 1 with version 2 or later</h3>
	<p>To replace SUPEE-7877 version 1 with version 2 or later:</p>
	<ol><li>Log in to your Magento server.</li>
		<li>Open <code>&lt;your Magento install dir>/app/etc/applied.patches.list</code> in a text editor.<br><br>
			This file lists all currently applied patches.</li>
		<li>Determine which patches are already applied. Version 1 of SUPEE-8788 includes <code>PATCH_SUPEE-8788_&lt;magento version>_v1</code> in the name.</li>
		<li>If your Magento version is EE 1.14.1.0 or CE 1.9.1.0, <em>and</em> patch SUPEE-1533 is applied, <a href="#revert">revert</a> SUPEE-1533.</li>
		<li>If your Magento version is earlier than EE 1.14.1.0 or CE 1.9.1.0, <em>and</em> SUPEE-3941 is not applied, <a href="#apply">apply SUPEE-3941</a>.</li>
		<li><a href="#get">Get</a> version 2 or later of SUPEE-8788.</li>
		<li><a href="#apply">Apply</a> version 2 or later of SUPEE-8788.</li>
		<li><em>Magento EE 1.14.2 only</em>. After applying the SUPEE-8788 patch, remove <code>test_oauth.php</code> from your Magento base directory.</li>
		<li>If you upgraded to Magento CE 1.9.3 or Magento EE 1.14.3 after applying the <a href="https://magento.com/security/patches/supee-8788" target="_blank">SUPEE-8788 patch</a>, make sure the following files have been deleted:<br>

			<pre>skin/adminhtml/default/default/media/flex.swf
skin/adminhtml/default/default/media/uploader.swf
skin/adminhtml/default/default/media/uploaderSingle.swf</pre>

			If the files are present, delete them to avoid a potential security exploit. As of Magento CE 1.9.0.0 and Magento EE 1.14.0.0, we no longer distribute <code>.swf</code> files with the Magento software.</li></ol>

	<h3 id="apply-8788-new">Apply SUPEE-8788</h3>
	<p>To apply patch SUPEE-8788:</p>
	<ol><li>Open <code>&lt;your Magento install dir>/app/etc/applied.patches.list</code> in a text editor.<br><br>
		This file lists all currently applied patches.</li>
		<li>Verify SUPEE-8788 is <em>not</em> applied. If it is, and it's version 1, see <a href="#apply-8788-v1">Replace SUPEE-8788 version 1 with version 2 or later</a>.</li>
		<li>Verify whether or not patch SUPEE-1533 is applied. If it is, <em>and</em> your Magento version is earlier than EE 1.14.1.0 or CE 1.9.1.0, <a href="#revert">revert</a> SUPEE-1533.</li>
		<li>If your Magento version is earlier than EE 1.14.1.0 or CE 1.9.1.0, <em>and</em> SUPEE-3941 is not applied, <a href="#apply">apply SUPEE-3941</a>.</li>
		<li><a href="#get">Get</a> version 2 or later of SUPEE-8788.</li>
		<li><a href="#apply">Apply</a> version 2 or later of SUPEE-8788.</li>
		<li><em>Magento EE 1.14.2 only</em>. After applying the SUPEE-8788 patch, remove <code>test_oauth.php</code> from your Magento base directory.</li>
		<li>If you upgraded to Magento CE 1.9.3 or Magento EE 1.14.3 after applying the <a href="https://magento.com/security/patches/supee-8788" target="_blank">SUPEE-8788 patch</a>, make sure the following files have been deleted:<br>

			<pre>skin/adminhtml/default/default/media/flex.swf
skin/adminhtml/default/default/media/uploader.swf
skin/adminhtml/default/default/media/uploaderSingle.swf</pre>

			If the files are present, delete them to avoid a potential security exploit. As of Magento CE 1.9.0.0 and Magento EE 1.14.0.0, we no longer distribute <code>.swf</code> files with the Magento software.</li></ol>

	<h2 id="id">Listing Patches You Have Installed</h2>
	<p>If you're not sure which patches are already applied, open <code>&lt;your Magento install dir>/app/etc/applied.patches.list</code>.</p>

	<h2 id="revert">How to Revert a Magento Patch</h2>
	<p>If applying the patch results in errors, <a href="http://support.magentocommerce.com/" target="_blank">contact Magento Support</a>. If you are instructed to do so, revert the patch:</p>
	<ol><li>Change to your Magento installation directory.</li>
		<li>Enter the following command as a user with sufficient privileges to write to Magento files (typically, the web server user or <code>root</code>):<br />
			<pre>sh <em>patch-file-name</em>.sh -R</pre></li></ol>

	<h2 id="trouble">Troubleshooting</h2>
	<p>If you get an error when you run the patch, use the following suggestions:</p>
	<ul><li>Verify the patch is located in your Magento installation root directory.<br />
		Ubuntu example: <code>/var/www/magento</code><br />
		CentOS example: <code>/var/www/html/magento</code></li>
		<li>Verify you're running the patch with sufficient privileges.<br />
			Typically, this means running it as the web server user or as a user with <code>root</code> privileges.</li>
		<li>Try running the patch again.<br />
			If problems persist, <a href="http://support.magentocommerce.com/" target="_blank">contact Magento Support</a>.</li>
	</ul>
</div>
</body>
</html>